@extends('layout.app') @section('content')

    <div class="box-body">

        <table id="rowed3"></table>
        <div id="prowed3"></div>

    </div>

    <script>
        $(document).ready(function() {

            var data = {
                url: "/user/record",
                postData: postData(),
                colNames: ['时间', '用户Id', '昵称', '增加前', '增加后', '获得', '类型'],
                colModel: [{
                    name: 'create_time',
                    formatter:'date',
                    formatoptions: {srcformat: 'Y-m-d H:i:s', newformat: 'Y-m-d H:i:s'},
                    searchoptions: {
                        sopt: ['lt', 'le', 'gt', 'ge'],
                        dataInit : function (elem) {
                            $(elem).datepicker({
                                dateFormat: 'yy-mm-dd',
                                monthNames: ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'],
                                dayNamesMin: ['日','一','二','三','四','五','六'] });
                        }
                    }
                }, {
                    name: 'user_id'
                }, {
                    name: 'nickname',
                    sortable: false,
                    search: false
                }, {
                    name: 'before',
                    sortable: false,
                    formatter: function(cellvalue) {
                        return cellvalue / 100;
                    }
                }, {
                    name: 'after',
                    sortable: false,
                    formatter: function(cellvalue) {
                        return cellvalue / 100;
                    }
                }, {
                    name: 'money',
                    formatter: function(cellvalue) {
                        if (cellvalue > 0) {
                            return '<span class="text-success"></i> +' + cellvalue/100 + '</span>';
                        } else {
                            return '<span class="text-danger"></i> ' + cellvalue/100 + '</span>';
                        }
                    }
                }, {
                    name: 'type',
                    sortable: false,
                    stype: 'select',
                    searchoptions: {
                        sopt: ["eq", "ne"],
                        value: "0:绑定手机号;1:购卡;2:充值;3:提现;4:后台转账;5:转卖;6:佣金转入;7:总代分成;8:转账;9:伙伴通道费"
                    },
                    formatter: function(cellvalue, options, object) {
                        cellvalue = cellvalue.toString();
                        switch (cellvalue) {
                        	case "0":
                            	return "绑定手机号";
                            case "1":
                                return "购卡";
                            case "2":
                                return "充值";
                            case "3":
                                return "提现";
                            case "4":
                                return object.detail;
                            case "5":
                                return "转卖";
                            case "6":
                                return "佣金转入";
                            case "7":
                                return "伙伴分成";
                            case "8":
                                return "转账";
                            case "9":
                                return "伙伴通道费";
                        }
                        return cellvalue;
                    }
                }],
                caption: '<i class="fa fa-table"></i> {{$label2}}',
                sortname: 'id',
                sortorder: "desc",
            };

            jqGrid(data);
        });

        function postData() {
            return {
                @if($request->get("user_id"))
                user_id: '{{$request->get("user_id")}}',
                @endif
                @if($request->get("type"))
                type: '{{$request->get("type")}}',
                @endif
            }
        }
    </script>

@endsection